<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <link rel="icon" type="image/svg+xml" href="/vite.svg" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="description" content="RedFire - 专业量化交易平台" />
    <meta name="keywords" content="量化交易,股票,期货,基金,投资,金融" />
    <title>RedFire - 量化交易平台</title>
    
    <!-- 预加载关键资源 -->
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    
    <!-- 防止闪烁的初始样式 -->
    <style>
      body {
        margin: 0;
        padding: 0;
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
          'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
          sans-serif;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        background-color: #f5f5f5;
      }
      
      #root {
        min-height: 100vh;
      }
      
      /* 加载动画 */
      .loading-screen {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 9999;
      }
      
      .loading-content {
        text-align: center;
        color: white;
      }
      
      .loading-logo {
        width: 80px;
        height: 80px;
        margin: 0 auto 20px;
        border: 4px solid rgba(255, 255, 255, 0.3);
        border-top: 4px solid white;
        border-radius: 50%;
        animation: spin 1s linear infinite;
      }
      
      .loading-text {
        font-size: 24px;
        font-weight: 600;
        margin-bottom: 8px;
      }
      
      .loading-subtitle {
        font-size: 14px;
        opacity: 0.8;
      }
      
      @keyframes spin {
        0% { transform: rotate(0deg); }
        100% { transform: rotate(360deg); }
      }
      
      /* 隐藏加载屏幕 */
      .loading-screen.hidden {
        opacity: 0;
        transition: opacity 0.3s ease-out;
        pointer-events: none;
      }
    </style>
  </head>
  
  <body>
    <!-- 加载屏幕 -->
    <div id="loading-screen" class="loading-screen">
      <div class="loading-content">
        <div class="loading-logo"></div>
        <div class="loading-text">RedFire</div>
        <div class="loading-subtitle">专业量化交易平台</div>
      </div>
    </div>
    
    <!-- React 应用根节点 -->
    <div id="root"></div>
    
    <!-- 应用脚本 -->
    <script type="module" src="/src/main.tsx"></script>
    
    <!-- 隐藏加载屏幕的脚本 -->
    <script>
      // 当应用加载完成后隐藏加载屏幕
      window.addEventListener('load', function() {
        setTimeout(function() {
          const loadingScreen = document.getElementById('loading-screen');
          if (loadingScreen) {
            loadingScreen.classList.add('hidden');
            setTimeout(function() {
              loadingScreen.remove();
            }, 300);
          }
        }, 500);
      });
      
      // 错误处理
      window.addEventListener('error', function(e) {
        console.error('应用加载错误:', e.error);
      });
      
      window.addEventListener('unhandledrejection', function(e) {
        console.error('未处理的Promise拒绝:', e.reason);
      });
    </script>
  </body>
</html>